package com.moyq5.mvc.maker.test.bean.entity;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PrePersist;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import com.moyq5.mvc.maker.test.bean.enums.SysPayMethod;
import com.moyq5.mvc.maker.test.bean.enums.SysPayType;
import com.moyq5.mvc.maker.test.bean.enums.SysProfitType;
import com.moyq5.mvc.maker.test.bean.enums.SysSettleType;

/**
 * 分成/费率信息
 * @author Moyq5
 * @date 2017年12月12日
 */
@Entity
@Table(name = "tra_fee")
@DynamicUpdate
public class TraFee implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5608159436748880607L;
	/**
	 * 费率ID
	 */
	@Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "native")@GenericGenerator(name = "native", strategy = "native")
    @Column(name = "fee_id")
	private Long feeId;
	/**
	 * 结算类型，多选
	 * @see {@link SysSettleType}
	 */
	@Column(name = "settle_type", precision = 8, nullable = false)
	private Integer settleType;
	/**
	 * 支付类型，多选
	 * @see {@link SysPayType}
	 */
	@Column(name = "pay_type", precision = 8, nullable = false)
	private Integer payType;
	/**
	 * 支付方式，多选
	 * @see {@link SysPayMethod}
	 */
	@Column(name = "pay_method", precision = 8, nullable = false)
	private Integer payMethod;
	/**
	 * 分成方式
	 */
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "profit_type", precision = 1, scale = 0, nullable = false, columnDefinition = "int(1) not null default '0'")
	private SysProfitType profitType;
	/**
	 * 分成比例/成本费率，如：0.0049
	 */
	@Column(name = "rate", precision = 5, scale = 4)
	private BigDecimal rate;
	/**
	 * D0增量手续费保底（元）
	 */
	@Column(name = "fee_d0_min", precision = 10, scale = 2, nullable = false)
	private BigDecimal feeD0Min;
	/**
	 * 提现费（元）
	 */
	@Column(name = "fee_remit", precision = 10, scale = 2, nullable = false)
	private BigDecimal feeRemit;
	/**
	 * 总手续费保底（元），不包含提现费
	 */
	@Column(name = "fee_total_min", precision = 10, scale = 2, nullable = false)
	private BigDecimal feeTotalMin;
	
	@PrePersist
	public void prePersist() {
		if (null == profitType) {
			profitType = SysProfitType.TRANS_RATE;
		}
	}
	public Long getFeeId() {
		return feeId;
	}
	public void setFeeId(Long feeId) {
		this.feeId = feeId;
	}
	public Integer getSettleType() {
		return settleType;
	}
	public void setSettleType(Integer settleType) {
		this.settleType = settleType;
	}
	public Integer getPayType() {
		return payType;
	}
	public void setPayType(Integer payType) {
		this.payType = payType;
	}
	public Integer getPayMethod() {
		return payMethod;
	}
	public void setPayMethod(Integer payMethod) {
		this.payMethod = payMethod;
	}
	public BigDecimal getRate() {
		return rate;
	}
	public void setRate(BigDecimal rate) {
		this.rate = rate;
	}
	public BigDecimal getFeeD0Min() {
		return feeD0Min;
	}
	public void setFeeD0Min(BigDecimal feeD0Min) {
		this.feeD0Min = feeD0Min;
	}
	public BigDecimal getFeeRemit() {
		return feeRemit;
	}
	public void setFeeRemit(BigDecimal feeRemit) {
		this.feeRemit = feeRemit;
	}
	public BigDecimal getFeeTotalMin() {
		return feeTotalMin;
	}
	public void setFeeTotalMin(BigDecimal feeTotalMin) {
		this.feeTotalMin = feeTotalMin;
	}
	public SysProfitType getProfitType() {
		return profitType;
	}
	public void setProfitType(SysProfitType profitType) {
		this.profitType = profitType;
	}
	
}
